package com.api.apigateway.mq;

import com.api.common.constant.APIInterfaceMqConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author: 崔老爷
 * Date: 2024/10/20 13:51
 * @Description: 网关刷新mq消息生产者
 */

@Component
@Slf4j
public class GatewayRefreshProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendMessage(String message) {
        rabbitTemplate.convertAndSend(
                APIInterfaceMqConstant.API_DYNAMIC_ROUTE_EXCHANGE,
                APIInterfaceMqConstant.API_DYNAMIC_REFRESH_ROUTE_ROUTE_KEY,
                message
        );
    }
}
